package com.ysy.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum NoteCollectEnum {

    NOTE_ALREADY_COLLECT(2L,"已经收藏"),
    NOTE_COLLECT(1L,"收藏成功"),
    NOTE_UN_COLLECT(0L,"未收藏"),
    NO_EXISTS(-1L,"未找到收藏缓存")
    ;

    private Long status;
    private String desc;

    private static Map<Long, NoteCollectEnum> cache;

    static {
        cache = Arrays.stream(NoteCollectEnum.values()).collect(Collectors.toMap(NoteCollectEnum::getStatus, e -> e));
    }

    public static NoteCollectEnum get(Long status) {
        return cache.get(status);
    }
}
